package com.ruige.account.oauth.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruige.account.oauth.mapper.UserMapper;
import com.ruige.account.oauth.pojo.User;
import com.ruige.account.oauth.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * <p>
 * 用户表 服务实现类
 * </p>
 *
 * @author huangrui
 * @since 2020-05-25
 */
@Service
public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IUserService {

    @Autowired
    private UserMapper userMapper;

    @Override
    public Map findMap() {
        List<Map<String,String>> mapList= userMapper.findMap();
        Map map = new HashMap();
        for (Map<String, String> stringMap : mapList) {
            map.put(stringMap.get("username"), stringMap.get("name"));
        }
        System.out.println("map = " + map.toString());
        return map;
    }

    @Override
    public List<User> findAll() {
        return userMapper.findAll();
    }

}
